package com.spark.usermusicService.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.spark.usermusicService.entity.Music;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface JoinMusicMapper extends BaseMapper<Music> {

    @Select("SELECT m.* FROM `music` m INNER JOIN `music_list` ml ON ml.`playlist_id`=#{playlistId} AND ml.`music_id`=m.`id`")
    List<Music> musiclistJoinMusic(String playlistId);

    @Select("SELECT m.* FROM `music` m INNER JOIN `love_music` ml ON ml.`user_id`=#{userId} AND ml.`music_id`=m.`id`")
    List<Music> lovelistJoinMusic(String userId);
}
